#include <hxcpp.h>

#ifndef INCLUDED_format_tools_Adler32
#include <format/tools/Adler32.h>
#endif
#ifndef INCLUDED_format_tools_HuffTools
#include <format/tools/HuffTools.h>
#endif
#ifndef INCLUDED_format_tools_Huffman
#include <format/tools/Huffman.h>
#endif
#ifndef INCLUDED_format_tools_InflateImpl
#include <format/tools/InflateImpl.h>
#endif
#ifndef INCLUDED_format_tools__InflateImpl_State
#include <format/tools/_InflateImpl/State.h>
#endif
#ifndef INCLUDED_format_tools__InflateImpl_Window
#include <format/tools/_InflateImpl/Window.h>
#endif
#ifndef INCLUDED_haxe_io_Bytes
#include <haxe/io/Bytes.h>
#endif
#ifndef INCLUDED_haxe_io_BytesBuffer
#include <haxe/io/BytesBuffer.h>
#endif
#ifndef INCLUDED_haxe_io_Error
#include <haxe/io/Error.h>
#endif
#ifndef INCLUDED_haxe_io_Input
#include <haxe/io/Input.h>
#endif
namespace format{
namespace tools{

Void InflateImpl_obj::__construct(::haxe::io::Input i,Dynamic __o_header,Dynamic __o_crc)
{
Dynamic header = __o_header.Default(true);
Dynamic crc = __o_crc.Default(true);
{
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",122)
	this->final = false;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",123)
	this->htools = ::format::tools::HuffTools_obj::__new();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",124)
	this->huffman = this->buildFixedHuffman();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",125)
	this->huffdist = null();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",126)
	this->len = (int)0;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",127)
	this->dist = (int)0;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",128)
	this->state = (  ((header)) ? ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Head_dyn()) : ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Block_dyn()) );
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",129)
	this->input = i;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",130)
	this->bits = (int)0;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",131)
	this->nbits = (int)0;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",132)
	this->needed = (int)0;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",133)
	this->output = null();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",134)
	this->outpos = (int)0;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",135)
	this->lengths = Array_obj< int >::__new();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",136)
	{
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",136)
		int _g = (int)0;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",136)
		while(((_g < (int)19))){
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",136)
			int i1 = (_g)++;
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",137)
			this->lengths->push((int)-1);
		}
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",138)
	this->window = ::format::tools::_InflateImpl::Window_obj::__new(crc);
}
;
	return null();
}

InflateImpl_obj::~InflateImpl_obj() { }

Dynamic InflateImpl_obj::__CreateEmpty() { return  new InflateImpl_obj; }
hx::ObjectPtr< InflateImpl_obj > InflateImpl_obj::__new(::haxe::io::Input i,Dynamic __o_header,Dynamic __o_crc)
{  hx::ObjectPtr< InflateImpl_obj > result = new InflateImpl_obj();
	result->__construct(i,__o_header,__o_crc);
	return result;}

Dynamic InflateImpl_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< InflateImpl_obj > result = new InflateImpl_obj();
	result->__construct(inArgs[0],inArgs[1],inArgs[2]);
	return result;}

::format::tools::Huffman InflateImpl_obj::buildFixedHuffman( ){
	HX_SOURCE_PUSH("InflateImpl_obj::buildFixedHuffman")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",142)
	if (((::format::tools::InflateImpl_obj::FIXED_HUFFMAN != null()))){
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",143)
		return ::format::tools::InflateImpl_obj::FIXED_HUFFMAN;
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",144)
	Array< int > a = Array_obj< int >::__new();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",145)
	{
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",145)
		int _g = (int)0;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",145)
		while(((_g < (int)288))){
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",145)
			int n = (_g)++;
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",146)
			a->push((  (((n <= (int)143))) ? int((int)8) : int((  (((n <= (int)255))) ? int((int)9) : int((  (((n <= (int)279))) ? int((int)7) : int((int)8) )) )) ));
		}
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",147)
	::format::tools::InflateImpl_obj::FIXED_HUFFMAN = this->htools->make(a,(int)0,(int)288,(int)10);
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",148)
	return ::format::tools::InflateImpl_obj::FIXED_HUFFMAN;
}


HX_DEFINE_DYNAMIC_FUNC0(InflateImpl_obj,buildFixedHuffman,return )

int InflateImpl_obj::readBytes( ::haxe::io::Bytes b,int pos,int len){
	HX_SOURCE_PUSH("InflateImpl_obj::readBytes")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",152)
	this->needed = len;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",153)
	this->outpos = pos;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",154)
	this->output = b;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",155)
	if (((len > (int)0))){
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",156)
		while((this->inflateLoop())){
		}
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",158)
	return (len - this->needed);
}


HX_DEFINE_DYNAMIC_FUNC3(InflateImpl_obj,readBytes,return )

int InflateImpl_obj::getBits( int n){
	HX_SOURCE_PUSH("InflateImpl_obj::getBits")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",162)
	while(((this->nbits < n))){
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",163)
		hx::OrEq(this->bits,(int(this->input->readByte()) << int(this->nbits)));
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",164)
		hx::AddEq(this->nbits,(int)8);
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",166)
	int b = (int(this->bits) & int((((int((int)1) << int(n))) - (int)1)));
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",167)
	hx::SubEq(this->nbits,n);
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",168)
	hx::ShrEq(this->bits,n);
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",169)
	return b;
}


HX_DEFINE_DYNAMIC_FUNC1(InflateImpl_obj,getBits,return )

bool InflateImpl_obj::getBit( ){
	HX_SOURCE_PUSH("InflateImpl_obj::getBit")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",173)
	if (((this->nbits == (int)0))){
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",174)
		this->nbits = (int)8;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",175)
		this->bits = this->input->readByte();
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",177)
	bool b = (((int(this->bits) & int((int)1))) == (int)1);
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",178)
	(this->nbits)--;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",179)
	hx::ShrEq(this->bits,(int)1);
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",180)
	return b;
}


HX_DEFINE_DYNAMIC_FUNC0(InflateImpl_obj,getBit,return )

int InflateImpl_obj::getRevBits( int n){
	HX_SOURCE_PUSH("InflateImpl_obj::getRevBits")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",183)
	return (  (((n == (int)0))) ? int((int)0) : int((  ((this->getBit())) ? int((int((int((int)1) << int((n - (int)1)))) | int(this->getRevBits((n - (int)1))))) : int(this->getRevBits((n - (int)1))) )) );
}


HX_DEFINE_DYNAMIC_FUNC1(InflateImpl_obj,getRevBits,return )

Void InflateImpl_obj::resetBits( ){
{
		HX_SOURCE_PUSH("InflateImpl_obj::resetBits")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",193)
		this->bits = (int)0;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",194)
		this->nbits = (int)0;
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(InflateImpl_obj,resetBits,(void))

Void InflateImpl_obj::addBytes( ::haxe::io::Bytes b,int p,int len){
{
		HX_SOURCE_PUSH("InflateImpl_obj::addBytes")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",198)
		this->window->addBytes(b,p,len);
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",199)
		this->output->blit(this->outpos,b,p,len);
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",200)
		hx::SubEq(this->needed,len);
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",201)
		hx::AddEq(this->outpos,len);
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC3(InflateImpl_obj,addBytes,(void))

Void InflateImpl_obj::addByte( int b){
{
		HX_SOURCE_PUSH("InflateImpl_obj::addByte")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",205)
		this->window->addByte(b);
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",206)
		this->output->b[this->outpos] = b;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",207)
		(this->needed)--;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",208)
		(this->outpos)++;
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC1(InflateImpl_obj,addByte,(void))

Void InflateImpl_obj::addDistOne( int n){
{
		HX_SOURCE_PUSH("InflateImpl_obj::addDistOne")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",212)
		int c = this->window->getLastChar();
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",213)
		{
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",213)
			int _g = (int)0;
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",213)
			while(((_g < n))){
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",213)
				int i = (_g)++;
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",214)
				this->addByte(c);
			}
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC1(InflateImpl_obj,addDistOne,(void))

Void InflateImpl_obj::addDist( int d,int len){
{
		HX_SOURCE_PUSH("InflateImpl_obj::addDist")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",217)
		this->addBytes(this->window->buffer,(this->window->pos - d),len);
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC2(InflateImpl_obj,addDist,(void))

int InflateImpl_obj::applyHuffman( ::format::tools::Huffman h){
	HX_SOURCE_PUSH("InflateImpl_obj::applyHuffman")
	struct _Function_1_1{
		inline static int Block( ::format::tools::Huffman &h,::format::tools::InflateImpl_obj *__this){
			{
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",222)
				{
::format::tools::Huffman _switch_1 = (h);
					switch((_switch_1)->GetIndex()){
						case 0: {
							int n = _switch_1->__Param(0);
{
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",223)
								return n;
							}
						}
						;break;
						case 1: {
							::format::tools::Huffman b = _switch_1->__Param(1);
							::format::tools::Huffman a = _switch_1->__Param(0);
{
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",224)
								return __this->applyHuffman((  ((__this->getBit())) ? ::format::tools::Huffman(b) : ::format::tools::Huffman(a) ));
							}
						}
						;break;
						case 2: {
							Array< ::format::tools::Huffman > tbl = _switch_1->__Param(1);
							int n = _switch_1->__Param(0);
{
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",225)
								return __this->applyHuffman(tbl->__get(__this->getBits(n)));
							}
						}
						;break;
					}
				}
			}
			return null();
		}
	};
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",221)
	return _Function_1_1::Block(h,this);
}


HX_DEFINE_DYNAMIC_FUNC1(InflateImpl_obj,applyHuffman,return )

Void InflateImpl_obj::inflateLengths( Array< int > a,int max){
{
		HX_SOURCE_PUSH("InflateImpl_obj::inflateLengths")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",230)
		int i = (int)0;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",231)
		int prev = (int)0;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",232)
		while(((i < max))){
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",233)
			int n = this->applyHuffman(this->huffman);
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",234)
			switch( (int)(n)){
				case (int)0: case (int)1: case (int)2: case (int)3: case (int)4: case (int)5: case (int)6: case (int)7: case (int)8: case (int)9: case (int)10: case (int)11: case (int)12: case (int)13: case (int)14: case (int)15: {
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",236)
					prev = n;
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",237)
					a[i] = n;
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",238)
					(i)++;
				}
				;break;
				case (int)16: {
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",240)
					int end = ((i + (int)3) + this->getBits((int)2));
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",241)
					if (((end > max))){
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",241)
						hx::Throw (HX_CSTRING("Invalid data"));
					}
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",242)
					while(((i < end))){
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",243)
						a[i] = prev;
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",244)
						(i)++;
					}
				}
				;break;
				case (int)17: {
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",247)
					hx::AddEq(i,((int)3 + this->getBits((int)3)));
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",248)
					if (((i > max))){
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",248)
						hx::Throw (HX_CSTRING("Invalid data"));
					}
				}
				;break;
				case (int)18: {
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",250)
					hx::AddEq(i,((int)11 + this->getBits((int)7)));
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",251)
					if (((i > max))){
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",251)
						hx::Throw (HX_CSTRING("Invalid data"));
					}
				}
				;break;
				default: {
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",252)
					hx::Throw (HX_CSTRING("Invalid data"));
				}
			}
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC2(InflateImpl_obj,inflateLengths,(void))

bool InflateImpl_obj::inflateLoop( ){
	HX_SOURCE_PUSH("InflateImpl_obj::inflateLoop")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",258)
	{
::format::tools::_InflateImpl::State _switch_2 = (this->state);
		switch((_switch_2)->GetIndex()){
			case 0: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",261)
				int cmf = this->input->readByte();
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",262)
				int cm = (int(cmf) & int((int)15));
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",263)
				int cinfo = (int(cmf) >> int((int)4));
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",264)
				if (((bool((cm != (int)8)) || bool((cinfo != (int)7))))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",264)
					hx::Throw (HX_CSTRING("Invalid data"));
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",265)
				int flg = this->input->readByte();
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",267)
				bool fdict = (((int(flg) & int((int)32))) != (int)0);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",269)
				if (((hx::Mod(((((int(cmf) << int((int)8))) + flg)),(int)31) != (int)0))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",269)
					hx::Throw (HX_CSTRING("Invalid data"));
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",270)
				if ((fdict)){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",270)
					hx::Throw (HX_CSTRING("Unsupported dictionary"));
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",271)
				this->state = ::format::tools::_InflateImpl::State_obj::Block_dyn();
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",272)
				return true;
			}
			;break;
			case 4: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",274)
				::format::tools::Adler32 calc = this->window->checksum();
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",275)
				if (((calc == null()))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",276)
					this->state = ::format::tools::_InflateImpl::State_obj::Done_dyn();
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",277)
					return true;
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",279)
				::format::tools::Adler32 crc = ::format::tools::Adler32_obj::read(this->input);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",280)
				if ((!(calc->equals(crc)))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",280)
					hx::Throw (HX_CSTRING("Invalid CRC"));
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",281)
				this->state = ::format::tools::_InflateImpl::State_obj::Done_dyn();
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",282)
				return true;
			}
			;break;
			case 7: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",283)
				return false;
			}
			;break;
			case 1: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",287)
				this->final = this->getBit();
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",288)
				switch( (int)(this->getBits((int)2))){
					case (int)0: {
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",290)
						this->len = this->input->readUInt16();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",291)
						int nlen = this->input->readUInt16();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",292)
						if (((nlen != ((int)65535 - this->len)))){
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",292)
							hx::Throw (HX_CSTRING("Invalid data"));
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",293)
						this->state = ::format::tools::_InflateImpl::State_obj::Flat_dyn();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",294)
						bool r = this->inflateLoop();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",295)
						this->resetBits();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",296)
						return r;
					}
					;break;
					case (int)1: {
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",298)
						this->huffman = this->buildFixedHuffman();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",299)
						this->huffdist = null();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",300)
						this->state = ::format::tools::_InflateImpl::State_obj::CData_dyn();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",301)
						return true;
					}
					;break;
					case (int)2: {
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",303)
						int hlit = (this->getBits((int)5) + (int)257);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",304)
						int hdist = (this->getBits((int)5) + (int)1);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",305)
						int hclen = (this->getBits((int)4) + (int)4);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",306)
						{
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",306)
							int _g = (int)0;
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",306)
							while(((_g < hclen))){
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",306)
								int i = (_g)++;
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",307)
								this->lengths[::format::tools::InflateImpl_obj::CODE_LENGTHS_POS->__get(i)] = this->getBits((int)3);
							}
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",308)
						{
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",308)
							int _g = hclen;
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",308)
							while(((_g < (int)19))){
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",308)
								int i = (_g)++;
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",309)
								this->lengths[::format::tools::InflateImpl_obj::CODE_LENGTHS_POS->__get(i)] = (int)0;
							}
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",310)
						this->huffman = this->htools->make(this->lengths,(int)0,(int)19,(int)8);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",311)
						Array< int > lengths = Array_obj< int >::__new();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",312)
						{
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",312)
							int _g1 = (int)0;
							int _g = (hlit + hdist);
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",312)
							while(((_g1 < _g))){
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",312)
								int i = (_g1)++;
								HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",313)
								lengths->push((int)0);
							}
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",314)
						this->inflateLengths(lengths,(hlit + hdist));
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",315)
						this->huffdist = this->htools->make(lengths,hlit,hdist,(int)16);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",316)
						this->huffman = this->htools->make(lengths,(int)0,hlit,(int)16);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",317)
						this->state = ::format::tools::_InflateImpl::State_obj::CData_dyn();
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",318)
						return true;
					}
					;break;
					default: {
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",319)
						hx::Throw (HX_CSTRING("Invalid data"));
					}
				}
			}
			;break;
			case 3: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",323)
				int rlen = (  (((this->len < this->needed))) ? int(this->len) : int(this->needed) );
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",324)
				::haxe::io::Bytes bytes = this->input->read(rlen);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",325)
				hx::SubEq(this->len,rlen);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",326)
				this->addBytes(bytes,(int)0,rlen);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",327)
				if (((this->len == (int)0))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",327)
					this->state = (  ((this->final)) ? ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Crc_dyn()) : ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Block_dyn()) );
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",328)
				return (this->needed > (int)0);
			}
			;break;
			case 6: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",330)
				int rlen = (  (((this->len < this->needed))) ? int(this->len) : int(this->needed) );
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",331)
				this->addDistOne(rlen);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",332)
				hx::SubEq(this->len,rlen);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",333)
				if (((this->len == (int)0))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",333)
					this->state = ::format::tools::_InflateImpl::State_obj::CData_dyn();
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",334)
				return (this->needed > (int)0);
			}
			;break;
			case 5: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",336)
				while(((bool((this->len > (int)0)) && bool((this->needed > (int)0))))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",337)
					int rdist = (  (((this->len < this->dist))) ? int(this->len) : int(this->dist) );
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",338)
					int rlen = (  (((this->needed < rdist))) ? int(this->needed) : int(rdist) );
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",339)
					this->addDist(this->dist,rlen);
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",340)
					hx::SubEq(this->len,rlen);
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",342)
				if (((this->len == (int)0))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",342)
					this->state = ::format::tools::_InflateImpl::State_obj::CData_dyn();
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",343)
				return (this->needed > (int)0);
			}
			;break;
			case 2: {
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",345)
				int n = this->applyHuffman(this->huffman);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",346)
				if (((n < (int)256))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",347)
					this->addByte(n);
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",348)
					return (this->needed > (int)0);
				}
				else{
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",349)
					if (((n == (int)256))){
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",350)
						this->state = (  ((this->final)) ? ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Crc_dyn()) : ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Block_dyn()) );
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",351)
						return true;
					}
					else{
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",353)
						hx::SubEq(n,(int)257);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",354)
						int extra_bits = ::format::tools::InflateImpl_obj::LEN_EXTRA_BITS_TBL->__get(n);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",355)
						if (((extra_bits == (int)-1))){
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",355)
							hx::Throw (HX_CSTRING("Invalid data"));
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",356)
						this->len = (::format::tools::InflateImpl_obj::LEN_BASE_VAL_TBL->__get(n) + this->getBits(extra_bits));
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",357)
						int dist_code = (  (((this->huffdist == null()))) ? int(this->getRevBits((int)5)) : int(this->applyHuffman(this->huffdist)) );
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",358)
						extra_bits = ::format::tools::InflateImpl_obj::DIST_EXTRA_BITS_TBL->__get(dist_code);
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",359)
						if (((extra_bits == (int)-1))){
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",359)
							hx::Throw (HX_CSTRING("Invalid data"));
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",360)
						this->dist = (::format::tools::InflateImpl_obj::DIST_BASE_VAL_TBL->__get(dist_code) + this->getBits(extra_bits));
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",361)
						if (((this->dist > this->window->available()))){
							HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",361)
							hx::Throw (HX_CSTRING("Invalid data"));
						}
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",362)
						this->state = (  (((this->dist == (int)1))) ? ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::DistOne_dyn()) : ::format::tools::_InflateImpl::State(::format::tools::_InflateImpl::State_obj::Dist_dyn()) );
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",363)
						return true;
					}
				}
			}
			;break;
		}
	}
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",258)
	return false;
}


HX_DEFINE_DYNAMIC_FUNC0(InflateImpl_obj,inflateLoop,return )

Array< int > InflateImpl_obj::LEN_EXTRA_BITS_TBL;

Array< int > InflateImpl_obj::LEN_BASE_VAL_TBL;

Array< int > InflateImpl_obj::DIST_EXTRA_BITS_TBL;

Array< int > InflateImpl_obj::DIST_BASE_VAL_TBL;

Array< int > InflateImpl_obj::CODE_LENGTHS_POS;

::format::tools::Huffman InflateImpl_obj::FIXED_HUFFMAN;

::haxe::io::Bytes InflateImpl_obj::run( ::haxe::io::Input i,Dynamic __o_bufsize){
Dynamic bufsize = __o_bufsize.Default(65536);
	HX_SOURCE_PUSH("InflateImpl_obj::run");
{
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",369)
		::haxe::io::Bytes buf = ::haxe::io::Bytes_obj::alloc(bufsize);
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",370)
		::haxe::io::BytesBuffer output = ::haxe::io::BytesBuffer_obj::__new();
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",371)
		::format::tools::InflateImpl inflate = ::format::tools::InflateImpl_obj::__new(i,null(),null());
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",372)
		while((true)){
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",373)
			int len = inflate->readBytes(buf,(int)0,bufsize);
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
			{
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
				if (((bool((len < (int)0)) || bool((len > buf->length))))){
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
					hx::Throw (::haxe::io::Error_obj::OutsideBounds_dyn());
				}
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
				Array< unsigned char > b1 = output->b;
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
				Array< unsigned char > b2 = buf->b;
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
				{
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
					int _g1 = (int)0;
					int _g = len;
					HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
					while(((_g1 < _g))){
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
						int i1 = (_g1)++;
						HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",374)
						output->b->push(b2->__get(i1));
					}
				}
			}
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",375)
			if (((len < bufsize))){
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",376)
				break;
			}
		}
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/InflateImpl.hx",378)
		return output->getBytes();
	}
}


STATIC_HX_DEFINE_DYNAMIC_FUNC2(InflateImpl_obj,run,return )


InflateImpl_obj::InflateImpl_obj()
{
}

void InflateImpl_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(InflateImpl);
	HX_MARK_MEMBER_NAME(nbits,"nbits");
	HX_MARK_MEMBER_NAME(bits,"bits");
	HX_MARK_MEMBER_NAME(state,"state");
	HX_MARK_MEMBER_NAME(final,"final");
	HX_MARK_MEMBER_NAME(huffman,"huffman");
	HX_MARK_MEMBER_NAME(huffdist,"huffdist");
	HX_MARK_MEMBER_NAME(htools,"htools");
	HX_MARK_MEMBER_NAME(len,"len");
	HX_MARK_MEMBER_NAME(dist,"dist");
	HX_MARK_MEMBER_NAME(needed,"needed");
	HX_MARK_MEMBER_NAME(output,"output");
	HX_MARK_MEMBER_NAME(outpos,"outpos");
	HX_MARK_MEMBER_NAME(input,"input");
	HX_MARK_MEMBER_NAME(lengths,"lengths");
	HX_MARK_MEMBER_NAME(window,"window");
	HX_MARK_END_CLASS();
}

void InflateImpl_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(nbits,"nbits");
	HX_VISIT_MEMBER_NAME(bits,"bits");
	HX_VISIT_MEMBER_NAME(state,"state");
	HX_VISIT_MEMBER_NAME(final,"final");
	HX_VISIT_MEMBER_NAME(huffman,"huffman");
	HX_VISIT_MEMBER_NAME(huffdist,"huffdist");
	HX_VISIT_MEMBER_NAME(htools,"htools");
	HX_VISIT_MEMBER_NAME(len,"len");
	HX_VISIT_MEMBER_NAME(dist,"dist");
	HX_VISIT_MEMBER_NAME(needed,"needed");
	HX_VISIT_MEMBER_NAME(output,"output");
	HX_VISIT_MEMBER_NAME(outpos,"outpos");
	HX_VISIT_MEMBER_NAME(input,"input");
	HX_VISIT_MEMBER_NAME(lengths,"lengths");
	HX_VISIT_MEMBER_NAME(window,"window");
}

Dynamic InflateImpl_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"run") ) { return run_dyn(); }
		if (HX_FIELD_EQ(inName,"len") ) { return len; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"bits") ) { return bits; }
		if (HX_FIELD_EQ(inName,"dist") ) { return dist; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"nbits") ) { return nbits; }
		if (HX_FIELD_EQ(inName,"state") ) { return state; }
		if (HX_FIELD_EQ(inName,"final") ) { return final; }
		if (HX_FIELD_EQ(inName,"input") ) { return input; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"htools") ) { return htools; }
		if (HX_FIELD_EQ(inName,"needed") ) { return needed; }
		if (HX_FIELD_EQ(inName,"output") ) { return output; }
		if (HX_FIELD_EQ(inName,"outpos") ) { return outpos; }
		if (HX_FIELD_EQ(inName,"window") ) { return window; }
		if (HX_FIELD_EQ(inName,"getBit") ) { return getBit_dyn(); }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"huffman") ) { return huffman; }
		if (HX_FIELD_EQ(inName,"lengths") ) { return lengths; }
		if (HX_FIELD_EQ(inName,"getBits") ) { return getBits_dyn(); }
		if (HX_FIELD_EQ(inName,"addByte") ) { return addByte_dyn(); }
		if (HX_FIELD_EQ(inName,"addDist") ) { return addDist_dyn(); }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"huffdist") ) { return huffdist; }
		if (HX_FIELD_EQ(inName,"addBytes") ) { return addBytes_dyn(); }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"readBytes") ) { return readBytes_dyn(); }
		if (HX_FIELD_EQ(inName,"resetBits") ) { return resetBits_dyn(); }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"getRevBits") ) { return getRevBits_dyn(); }
		if (HX_FIELD_EQ(inName,"addDistOne") ) { return addDistOne_dyn(); }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"inflateLoop") ) { return inflateLoop_dyn(); }
		break;
	case 12:
		if (HX_FIELD_EQ(inName,"applyHuffman") ) { return applyHuffman_dyn(); }
		break;
	case 13:
		if (HX_FIELD_EQ(inName,"FIXED_HUFFMAN") ) { return FIXED_HUFFMAN; }
		break;
	case 14:
		if (HX_FIELD_EQ(inName,"inflateLengths") ) { return inflateLengths_dyn(); }
		break;
	case 16:
		if (HX_FIELD_EQ(inName,"LEN_BASE_VAL_TBL") ) { return LEN_BASE_VAL_TBL; }
		if (HX_FIELD_EQ(inName,"CODE_LENGTHS_POS") ) { return CODE_LENGTHS_POS; }
		break;
	case 17:
		if (HX_FIELD_EQ(inName,"DIST_BASE_VAL_TBL") ) { return DIST_BASE_VAL_TBL; }
		if (HX_FIELD_EQ(inName,"buildFixedHuffman") ) { return buildFixedHuffman_dyn(); }
		break;
	case 18:
		if (HX_FIELD_EQ(inName,"LEN_EXTRA_BITS_TBL") ) { return LEN_EXTRA_BITS_TBL; }
		break;
	case 19:
		if (HX_FIELD_EQ(inName,"DIST_EXTRA_BITS_TBL") ) { return DIST_EXTRA_BITS_TBL; }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic InflateImpl_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"len") ) { len=inValue.Cast< int >(); return inValue; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"bits") ) { bits=inValue.Cast< int >(); return inValue; }
		if (HX_FIELD_EQ(inName,"dist") ) { dist=inValue.Cast< int >(); return inValue; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"nbits") ) { nbits=inValue.Cast< int >(); return inValue; }
		if (HX_FIELD_EQ(inName,"state") ) { state=inValue.Cast< ::format::tools::_InflateImpl::State >(); return inValue; }
		if (HX_FIELD_EQ(inName,"final") ) { final=inValue.Cast< bool >(); return inValue; }
		if (HX_FIELD_EQ(inName,"input") ) { input=inValue.Cast< ::haxe::io::Input >(); return inValue; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"htools") ) { htools=inValue.Cast< ::format::tools::HuffTools >(); return inValue; }
		if (HX_FIELD_EQ(inName,"needed") ) { needed=inValue.Cast< int >(); return inValue; }
		if (HX_FIELD_EQ(inName,"output") ) { output=inValue.Cast< ::haxe::io::Bytes >(); return inValue; }
		if (HX_FIELD_EQ(inName,"outpos") ) { outpos=inValue.Cast< int >(); return inValue; }
		if (HX_FIELD_EQ(inName,"window") ) { window=inValue.Cast< ::format::tools::_InflateImpl::Window >(); return inValue; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"huffman") ) { huffman=inValue.Cast< ::format::tools::Huffman >(); return inValue; }
		if (HX_FIELD_EQ(inName,"lengths") ) { lengths=inValue.Cast< Array< int > >(); return inValue; }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"huffdist") ) { huffdist=inValue.Cast< ::format::tools::Huffman >(); return inValue; }
		break;
	case 13:
		if (HX_FIELD_EQ(inName,"FIXED_HUFFMAN") ) { FIXED_HUFFMAN=inValue.Cast< ::format::tools::Huffman >(); return inValue; }
		break;
	case 16:
		if (HX_FIELD_EQ(inName,"LEN_BASE_VAL_TBL") ) { LEN_BASE_VAL_TBL=inValue.Cast< Array< int > >(); return inValue; }
		if (HX_FIELD_EQ(inName,"CODE_LENGTHS_POS") ) { CODE_LENGTHS_POS=inValue.Cast< Array< int > >(); return inValue; }
		break;
	case 17:
		if (HX_FIELD_EQ(inName,"DIST_BASE_VAL_TBL") ) { DIST_BASE_VAL_TBL=inValue.Cast< Array< int > >(); return inValue; }
		break;
	case 18:
		if (HX_FIELD_EQ(inName,"LEN_EXTRA_BITS_TBL") ) { LEN_EXTRA_BITS_TBL=inValue.Cast< Array< int > >(); return inValue; }
		break;
	case 19:
		if (HX_FIELD_EQ(inName,"DIST_EXTRA_BITS_TBL") ) { DIST_EXTRA_BITS_TBL=inValue.Cast< Array< int > >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void InflateImpl_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("nbits"));
	outFields->push(HX_CSTRING("bits"));
	outFields->push(HX_CSTRING("state"));
	outFields->push(HX_CSTRING("final"));
	outFields->push(HX_CSTRING("huffman"));
	outFields->push(HX_CSTRING("huffdist"));
	outFields->push(HX_CSTRING("htools"));
	outFields->push(HX_CSTRING("len"));
	outFields->push(HX_CSTRING("dist"));
	outFields->push(HX_CSTRING("needed"));
	outFields->push(HX_CSTRING("output"));
	outFields->push(HX_CSTRING("outpos"));
	outFields->push(HX_CSTRING("input"));
	outFields->push(HX_CSTRING("lengths"));
	outFields->push(HX_CSTRING("window"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	HX_CSTRING("LEN_EXTRA_BITS_TBL"),
	HX_CSTRING("LEN_BASE_VAL_TBL"),
	HX_CSTRING("DIST_EXTRA_BITS_TBL"),
	HX_CSTRING("DIST_BASE_VAL_TBL"),
	HX_CSTRING("CODE_LENGTHS_POS"),
	HX_CSTRING("FIXED_HUFFMAN"),
	HX_CSTRING("run"),
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("nbits"),
	HX_CSTRING("bits"),
	HX_CSTRING("state"),
	HX_CSTRING("final"),
	HX_CSTRING("huffman"),
	HX_CSTRING("huffdist"),
	HX_CSTRING("htools"),
	HX_CSTRING("len"),
	HX_CSTRING("dist"),
	HX_CSTRING("needed"),
	HX_CSTRING("output"),
	HX_CSTRING("outpos"),
	HX_CSTRING("input"),
	HX_CSTRING("lengths"),
	HX_CSTRING("window"),
	HX_CSTRING("buildFixedHuffman"),
	HX_CSTRING("readBytes"),
	HX_CSTRING("getBits"),
	HX_CSTRING("getBit"),
	HX_CSTRING("getRevBits"),
	HX_CSTRING("resetBits"),
	HX_CSTRING("addBytes"),
	HX_CSTRING("addByte"),
	HX_CSTRING("addDistOne"),
	HX_CSTRING("addDist"),
	HX_CSTRING("applyHuffman"),
	HX_CSTRING("inflateLengths"),
	HX_CSTRING("inflateLoop"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
	HX_MARK_MEMBER_NAME(InflateImpl_obj::LEN_EXTRA_BITS_TBL,"LEN_EXTRA_BITS_TBL");
	HX_MARK_MEMBER_NAME(InflateImpl_obj::LEN_BASE_VAL_TBL,"LEN_BASE_VAL_TBL");
	HX_MARK_MEMBER_NAME(InflateImpl_obj::DIST_EXTRA_BITS_TBL,"DIST_EXTRA_BITS_TBL");
	HX_MARK_MEMBER_NAME(InflateImpl_obj::DIST_BASE_VAL_TBL,"DIST_BASE_VAL_TBL");
	HX_MARK_MEMBER_NAME(InflateImpl_obj::CODE_LENGTHS_POS,"CODE_LENGTHS_POS");
	HX_MARK_MEMBER_NAME(InflateImpl_obj::FIXED_HUFFMAN,"FIXED_HUFFMAN");
};

static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::__mClass,"__mClass");
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::LEN_EXTRA_BITS_TBL,"LEN_EXTRA_BITS_TBL");
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::LEN_BASE_VAL_TBL,"LEN_BASE_VAL_TBL");
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::DIST_EXTRA_BITS_TBL,"DIST_EXTRA_BITS_TBL");
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::DIST_BASE_VAL_TBL,"DIST_BASE_VAL_TBL");
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::CODE_LENGTHS_POS,"CODE_LENGTHS_POS");
	HX_VISIT_MEMBER_NAME(InflateImpl_obj::FIXED_HUFFMAN,"FIXED_HUFFMAN");
};

Class InflateImpl_obj::__mClass;

void InflateImpl_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("format.tools.InflateImpl"), hx::TCanCast< InflateImpl_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void InflateImpl_obj::__boot()
{
	hx::Static(LEN_EXTRA_BITS_TBL) = Array_obj< int >::__new().Add((int)0).Add((int)0).Add((int)0).Add((int)0).Add((int)0).Add((int)0).Add((int)0).Add((int)0).Add((int)1).Add((int)1).Add((int)1).Add((int)1).Add((int)2).Add((int)2).Add((int)2).Add((int)2).Add((int)3).Add((int)3).Add((int)3).Add((int)3).Add((int)4).Add((int)4).Add((int)4).Add((int)4).Add((int)5).Add((int)5).Add((int)5).Add((int)5).Add((int)0).Add((int)-1).Add((int)-1);
	hx::Static(LEN_BASE_VAL_TBL) = Array_obj< int >::__new().Add((int)3).Add((int)4).Add((int)5).Add((int)6).Add((int)7).Add((int)8).Add((int)9).Add((int)10).Add((int)11).Add((int)13).Add((int)15).Add((int)17).Add((int)19).Add((int)23).Add((int)27).Add((int)31).Add((int)35).Add((int)43).Add((int)51).Add((int)59).Add((int)67).Add((int)83).Add((int)99).Add((int)115).Add((int)131).Add((int)163).Add((int)195).Add((int)227).Add((int)258);
	hx::Static(DIST_EXTRA_BITS_TBL) = Array_obj< int >::__new().Add((int)0).Add((int)0).Add((int)0).Add((int)0).Add((int)1).Add((int)1).Add((int)2).Add((int)2).Add((int)3).Add((int)3).Add((int)4).Add((int)4).Add((int)5).Add((int)5).Add((int)6).Add((int)6).Add((int)7).Add((int)7).Add((int)8).Add((int)8).Add((int)9).Add((int)9).Add((int)10).Add((int)10).Add((int)11).Add((int)11).Add((int)12).Add((int)12).Add((int)13).Add((int)13).Add((int)-1).Add((int)-1);
	hx::Static(DIST_BASE_VAL_TBL) = Array_obj< int >::__new().Add((int)1).Add((int)2).Add((int)3).Add((int)4).Add((int)5).Add((int)7).Add((int)9).Add((int)13).Add((int)17).Add((int)25).Add((int)33).Add((int)49).Add((int)65).Add((int)97).Add((int)129).Add((int)193).Add((int)257).Add((int)385).Add((int)513).Add((int)769).Add((int)1025).Add((int)1537).Add((int)2049).Add((int)3073).Add((int)4097).Add((int)6145).Add((int)8193).Add((int)12289).Add((int)16385).Add((int)24577);
	hx::Static(CODE_LENGTHS_POS) = Array_obj< int >::__new().Add((int)16).Add((int)17).Add((int)18).Add((int)0).Add((int)8).Add((int)7).Add((int)9).Add((int)6).Add((int)10).Add((int)5).Add((int)11).Add((int)4).Add((int)12).Add((int)3).Add((int)13).Add((int)2).Add((int)14).Add((int)1).Add((int)15);
	hx::Static(FIXED_HUFFMAN) = null();
}

} // end namespace format
} // end namespace tools
